/**
 * 测试接口列表
 */

import request from '../utils/request' // 导入request中创建的axios实例

const common = {
  /**
   * 登录
   */
  login(params: any) {
    return request.post(`/admin/login`, params)
  },

  /**
   * 登出
   */
  logout() {
    return request.post(`/admin/loginout`)
  },

  /**
   * 增加提问
   */
  addQuestion(params: any) {
    return request.post(`/content/add`, params)
  },

  updateQuestion(params: any) {
    return request.post(`/content/update`, params)
  },

  /**
   * 获取所有菜单
   */
  getMenuAll() {
    return request.post(`/menu/list/all`)
  },

  /**
   * 获取菜单详情
   */
  getContentList(params: any) {
    return request.post(`/content/list/bymenu`, params)
  },

  /**
   * 获取常见问题
   */
  getPopularList(params: any) {
    return request.post(`/content/list/popular`, params)
  },

  /**
   * 关键词搜索问题
   */
  getCommonSearch(params: any) {
    return request.post(`/content/search`, params)
  },

  /**
   * 删除内容
   */
  delContent(params: any) {
    return request.post(`/content/delete`, params)
  },

  /**
   * 新增菜单
   */
  addMenu(params: any) {
    return request.post(`/menu/add`, params)
  },

  /**
   * 获取菜单
   */
  getMenu(params: any) {
    return request.post(`/menu/list/first`, params)
  },

  /**
   * 更新菜单
   */
  updateMenu(params: any) {
    return request.post(`/menu/update`, params)
  },

  /**
   * 删除菜单
   */
  delMenu(params: any) {
    return request.post(`/menu/delete`, params)
  },

  /**
   * 获取问题详情
   */
  getKnowledgeDetail(params: any) {
    return request.post(`/content/detail`, params)
  },
  /**
   * 获取问题详情
   */
  uploadFile(params: any) {
    return request.post(`/uploadImage/common/upload/image/single`, params, 'upload')
  }
}

export default common
